package com.lebang.controller.sys.cences;

import com.alibaba.fastjson.JSONObject;
import com.lebang.common.Login;
import com.lebang.feign.bus.CencesCityApiCountFeign;
import com.lebang.model.RequestUserInfo;
import com.lebangweb.response.Callback;
import com.lebangweb.response.JsonData;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;


/**
 *
 * @author ljx
 * @date 2020-11-30
 */
@Controller
@RequestMapping("/sys/cencescityapicount")
public class CencesCityApiCountController {
    @Autowired
    private CencesCityApiCountFeign feign;

    @Login
    @GetMapping("/list")
    public String list(Model model, String appStore, String time) {
        model.addAttribute("appStore", appStore);
        model.addAttribute("time", time);
        return "/cencescityapicount/list";
    }

    @Login
    @ApiOperation(value = "分页")
    @PostMapping("/list")
    @ResponseBody
    public JSONObject list(HttpServletRequest request, @RequestParam Integer page, @RequestParam Integer limit, String appStore, Integer time) {
        RequestUserInfo userInfo = new RequestUserInfo(request);
        JsonData data=feign.getList(userInfo,page,limit,appStore,time);
        return JSONObject.parseObject(JSONObject.toJSONString(data.getData()));
    }
}
